<template>
	<view>
		<cc-couponList colors="#dba871" :couponList="couponList" @itemClick="jumpNext"></cc-couponList>
	</view>
</template>

<script>
export default {
	data() {
		return {
			couponList: []
		};
	},
	onLoad: function () {
		this.getList();
	},
	methods: {
		async getList() {
			let data = await this.$api.request('/base/getcoupon', 'GET');
			if (!data) return;
			console.log(data);
			this.couponList = data.map((item) => {
				return {
					name: item.title,
					dates: item.endtime,
					status: 0,
					money: item.value,
					sub: item.value
				};
			});
		},
		jumpNext(item) {
			uni.switchTab({
				url: '/pages/category/category'
			});
		}
	}
};
</script>

<style></style>
